package com.lv.LvPriceComboOfTourismForModify.dao;
import com.aqgj.util.BaseDaoImpl;
import com.lv.LvPriceComboOfTourismForModify.bean.LvPriceComboOfTourismForModify;
import org.springframework.stereotype.Repository;
/**
 * <p>
 *
 * </p>
 *
 * @ClassName LvPriceComboOfTourismForModifyDao
 * @JDK 1.5
 * @author
 * @date
 */
@Repository("LvPriceComboOfTourismForModifyDao")
public class LvPriceComboOfTourismForModifyDao extends BaseDaoImpl<LvPriceComboOfTourismForModify> {
    /**
     * 修改
     * @param lvPriceComboOfTourismForModify 实体bean
     * @return 0.失败，1.成功
     */
    public String update(LvPriceComboOfTourismForModify lvPriceComboOfTourismForModify) {
        this.getHibernateTemplate().saveOrUpdate(lvPriceComboOfTourismForModify);
        if (lvPriceComboOfTourismForModify.getId() != null) {
            return "1";
        }
        return "0";
    }

    /**
     * 删除修改的价格套餐
     * @param id 修改的价格套餐id
     * @param tourismId 在售模板id
     * @return
     */
    public String delete(String id, String tourismId) {
        String sql = "delete from lv_price_combo_of_tourism_for_modify where 1=1";
        if (id != null) {
            sql += " and id='" + id + "'";
        }
        if (tourismId != null) {
            sql += " and fk_tourism_for_sale_id='" + tourismId + "'";
        }
        if (this.currentSession().createNativeQuery(sql).executeUpdate() >= 0) {
            return "1";
        }
        return "0";
    }
}